<!DOCTYPE html>
<html>

	<head>
        <meta charset="utf-8" />
        <title></title>
        <link rel="stylesheet" type="text/css" href="/css/common.css" />
        <link rel="stylesheet" type="text/css" href="/bootstrap-3.3.7/css/bootstrap.min.css" />
        <link rel="stylesheet" type="text/css" href="/css/flatpickr.min.css" />
        <link rel="stylesheet" type="text/css" href="/css/font-awesome.css"/>
        <link rel="stylesheet" type="text/css" href="/dialog/css/dialog.css"/>

        <script src="/js/jquery-1.9.1.min.js" type="text/javascript"></script>
        <script src="/js/google-maps.js" type="text/javascript" charset="utf-8"></script>
        <script src="/js/jquery.validate.min.js" type="text/javascript" charset="utf-8"></script>
        <script src="/dialog/js/dialog.js" type="text/javascript" charset="utf-8"></script>
        <script src="/js/jquery.form.js"></script>
        <script src="/js/common.js"></script>
        <script src="/js/flatpickr.js" type="text/javascript" charset="utf-8"></script>
        <script src="/js/messages_zh.min.js" type="text/javascript" charset="utf-8"></script>
	</head>

	<body>
		<!--顶部导航 -->
		<nav class="topNavItemBox">
			<div id="ItemBox">
				<div class="title">肉品溯源管理系统</div>
			</div>
		</nav>
		<!-- 左侧导航 -->
		<#include "left.ftl" />

		<div class="page_main">
			<h3>养殖管理</h3><span class="add_link"><a href="/admin/Feeding/toAdd">新增养殖信息></a></span>
			<div class="page_content">
                <h4>养殖信息查询</h4>
				<br />
				<form id="cultureInfo_query" method="post" action="/admin/Feeding/findByCondition">
					<label style="width:100px">生猪编号</label><input type="text" name="purGid" value="${purGid}" class="commonInputtext" /><span></span>
					<label style="width:100px">开始日期</label><input type="text" name="beginTime" value="${beginTime}" data-enable-time=true data-enable-seconds=true id="beginTime" class="commonInputtext"  /><span></span>
					<label style="width:100px">结束日期</label><input type="text" name="endTime" value="${endTime}" data-enable-time=true data-enable-seconds=true id="endTime" class="commonInputtext"  />
					<input type="submit" value="查询" style="display: inline-block; margin-left: 30px;" />
					<!--<span class="newQuarantine"> <a hrquarantineInfo_add.ftlhtml">新增检疫情况></a></span>-->
				</form>
				<div>
					<table id="cultureInfo_table" class="table" width="100%">
						<thead>
							<tr>
								<th width="30"><input type="checkbox" onclick="selectAll()" id="allSelect" class="allSelect" ></th>
								<th width="150">信息编号</th>
								<th width="150">饲养企业</th>
								<th width="150">饲养区域</th>
								<th width="150">生猪编号</th>
								<th width="150">饲料用量</th>
								<th width="150">饲料单位</th>
								<th width="150">饲养时间</th>
								<th width="150">喂养人</th>
								<th width="150">备注</th>
								<th width="30"></th>
							</tr>
						</thead>
						<tbody>
							<#list pageInfo.list as  FeedingInfoVO>
								<tr>
									<td><input  name="isCheck" type="checkbox" value="${FeedingInfoVO.feedingInfor.feedingid}"/></td>
									<td>${FeedingInfoVO.feedingInfor.feedingid} </td>
									<td >${FeedingInfoVO.companyInfo.compname}</td>
									<td >${FeedingInfoVO.feedingInfor.areaid} </td>
									<td>${FeedingInfoVO.feedingInfor.animalid}</td>
									<td >${FeedingInfoVO.feeds.feedname}</td>
									<td >${FeedingInfoVO.feedingInfor.foodamount}${FeedingInfoVO.feedingInfor.foodunit}</td>
									<td >${(FeedingInfoVO.feedingInfor.feedingtime?string('yyyy-MM-dd'))}</td>
									<td >${FeedingInfoVO.employeeInfo.emName}</td>
									<td >${FeedingInfoVO.feedingInfor.remark}</td>
									<td ><input type="button" onclick="edit1(${FeedingInfoVO.feedingInfor.gid})"  value="编辑"/></td>
								</tr>
							</#list>
						</tbody>
					</table>
				</div>
				<div id="barcon" name="barcon" style="margin-left: 200px;font-size:10px"></div>
                <input type="button" id="delete" onclick="deleteByids()" value="删除所选">
			</div>
			<div class="footer">
				<div class="footer_lineone">
					<span id="logo"></span>肉品溯源管理系统 
					<span class="footer_lineoneSpan"><a href="aboutus.html">关于我们</a></span>
					<span class="footer_lineoneSpan"><a target="_blank" href="http://www.cfsiw.com/">食品安全信息</a></span> 
					<span class="footer_lineoneSpan"><a href="suggestionAdd.ftl">联系我们</a></span>
				</div>
				<div class="footer_linetwo">
					 &copy;2017广东技术师范学院
				</div>
			</div>
		</div>

		<script type="text/javascript" charset="UTF-8">
			$(function() {
				//初始化侧边栏
				$(".vertical-nav").verticalnav({
					speed: 400,
					align: "left"
				});
				
				//初始化时间
				$("#culture_date").flatpickr();
				$("#beginTime").flatpickr();
				$("#endTime").flatpickr();

					 //时间控制器
					$("input[name='feedingVo.feedingTime']").flatpickr(); 
				});

            //全选、全不选
            function selectAll() {
                if ($("#allSelect").is(":checked")) {
                    $("input[name='isCheck']").prop("checked",true);
                } else {
                    $("input[name='isCheck']").prop("checked",false);
                }
            }

            //批量删除
            function deleteByids() {
                var option = $("input[name='isCheck']:checked");
                var selectRows = "";
                for (i = 0; i< option.length;i++){
                    if(i == 0){
                        selectRows += option[i].value;
                    }else{
                        selectRows += "," + option[i].value;
                    }
                }
                alert(selectRows);
                $.dialog({
                    type: 'confirm',
                    contentHtml: '<p style:"magrin:0 auto">确认删除？</p>',
                    onClickOk: function() {
                        $.ajax({
                            url: "/admin/PigOut/delete",
                            data: {
                                'selectRows': selectRows
                            },
                            error: function(XMLHttpRequest, textStatus, errorThrown) {
                                //弹失败框
                                $.dialog({
                                    type: 'info',
                                    contentHtml: '<img class="info-icon" src="dialog/images/icon/fail.png" alt="删除失败" /><p class="info-text">删除失败</p>',
                                    autoClose: 1000
                                });
                            },
                            success: function() {
                                //弹成功框
                                $.dialog({
                                    type: 'info',
                                    contentHtml: '<img class="info-icon" src="dialog/images/icon/success.png" alt="删除成功" /><p class="info-text">删除成功</p>',
                                    autoClose: 1000
                                });
                                setTimeout("indow.location.reload();",2000);

                            }
                        });
                    }
                });
            }
		</script>

	</body>

</html>